package cat.inkubator.plugin4j.download;

import cat.inkubator.plugin4j.xml.Plugin;
import java.util.ArrayList;

/**
 *
 * @author gato
 */
public class UpdateLocalXML {
    
    public static boolean updateLocalXML( ArrayList<Plugin> local, ArrayList<Plugin> remote, ArrayList<int[]> updates ){
               
        int size = updates.size();
        for( int i=0; i < size; i++ ){
            int[] versions = updates.get(i);

            if( versions[0] != -1 ){
                local.get( versions[0] ).setVersion( remote.get( versions[1] ).getVersion() );
            }else{
                local.add( remote.get( versions[1] ) );
            }
            
        }

        return true;
    }

}
